#include <stdio.h>
#include <stdlib.h>

int main()
{
    int t = 0;
    scanf("%d", &t);
    while(t--)
    {
        int n = 0;
        scanf("%d", &n);
        int arr[n];
        scanf("%d", &arr[0]);
        int min = arr[0];
        int count = 1;
        for(int i = 1; i < n; i++)
        {
            scanf("%d", &arr[i]);
            if(arr[i] < min)
            {
                min = arr[i];
                count = 1;
            }
            else if(arr[i] == min)
            {
                count++;
            }
        }

        if(count == 1)
        {
            printf("yes\n");
        }
        else
        {
            int i = 1;
            for(i = 1; i < n; i++)
            {
                if(arr[i] == arr[i - 1])
                continue;

                int flag = 0;
                for(int j = i; j < n; j++)
                {
                    int mod = arr[j] > arr[i - 1] ? arr[j] % arr[j - 1] : arr[j - 1] % arr[j];
                    if(mod != 0 && mod < min)
                    {
                        flag = 1;
                        break;
                    }
                }
                if(flag)
                {
                    printf("yes\n");
                    break;
                }
            }
            if(i == n)
            printf("no\n");
        }
    }
    return 0;
}